<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head th:insert="common/header :: head"></head>
<body>
<div style="width: 300px;height: 200px"></div>
<script>
  let urlBase = "../api/user/";
  var v = new Vue({
    el: "#app",
    data: {
      xDataArr: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
      yDataArr: [3000, 2800, 900, 1000, 800, 700, 1400, 1300, 900, 1000, 800, 600],
      user: {}
    },
    created() {
      this.user = JSON.parse(sessionStorage.getItem("user"))
      //this.queryHistories()
      var mCharts = echarts.init(document.querySelector("div"))
      var xDataArr = this.xDataArr
      var yDataArr = this.yDataArr
      var option = {
        xAxis: {
          type: 'category',
          data: xDataArr
        },
        yAxis: {
          type: 'value'
        },
        series: [
          {
            type: 'line',
            data: yDataArr
          }
        ]
      }
      mCharts.setOption(option)
    },
    methods: {
      //获取老师上课的所有记录
      queryHistories() {
        axios.get(urlBase + "queryHistories?tid="+this.user.id).then(res => {
        })
      }
    }
  })

</script>
</body>
</html>
